using System.IO;
using Coderoom.ScrumPlanner.Configuration;

namespace Coderoom.ScrumPlanner.Tests.Integration.Internal
{
	internal class XmlRepositoryTestHelper
	{
		public static string DataDirectoryPath
		{
			get { return ConfigurationManager.GetXmlRepositoryDataDirectoryPath(); }
		}

		internal static void ResetProjectDataFile()
		{
			var sourceFilePath = Path.Combine(DataDirectoryPath, "Projects.default.xml");
			var newFilePath = Path.Combine(DataDirectoryPath, "Projects.xml");

			File.Copy(sourceFilePath, newFilePath, true);
		}

		public static void ResetThemeDataFile()
		{
			var sourceFilePath = Path.Combine(DataDirectoryPath, "Themes.default.xml");
			var newFilePath = Path.Combine(DataDirectoryPath, "Themes.xml");

			File.Copy(sourceFilePath, newFilePath, true);
		}

		public static void ResetUserStoryDataFile()
		{
			var sourceFilePath = Path.Combine(DataDirectoryPath, "UserStories.default.xml");
			var newFilePath = Path.Combine(DataDirectoryPath, "UserStories.xml");

			File.Copy(sourceFilePath, newFilePath, true);
		}

		public static void ResetTaskDataFile()
		{
			var sourceFilePath = Path.Combine(DataDirectoryPath, "Tasks.default.xml");
			var newFilePath = Path.Combine(DataDirectoryPath, "Tasks.xml");

			File.Copy(sourceFilePath, newFilePath, true);
		}

		public static void ResetSprintDataFile()
		{
			var sourceFilePath = Path.Combine(DataDirectoryPath, "Sprints.default.xml");
			var newFilePath = Path.Combine(DataDirectoryPath, "Sprints.xml");

			File.Copy(sourceFilePath, newFilePath, true);
		}
	}
}